Skip to content

pkg/templates as a nested module with RenderServer, validation and golden tests (WP-CLI1) - #5

Merged
tekn0ir merged 4 commits into
mainfrom
vd1-templates-module
Oct 12, 2026
Merged

tekn0ir merged 4 commits into
mainfrom
vd1-templates-module

Conversation

@tekn0ir

@tekn0ir tekn0ir commented Oct 11, 2026

Copy link
Copy Markdown
Contributor

What

WP-CLI1 of the virtual-device Phase 1 plan (~/teknoir-local-migration/docs/virtual-device-phase1-plan.md, section 4.1, decision P1-D7).

  • Root module renamed teknoir/cli -> github.com/teknoir/cli; all imports rewritten.
  • pkg/templates is now a nested, dependency-free module github.com/teknoir/cli/pkg/templates (go 1.22, no requires). The root go.mod requires it with a local replace, so go build . (goreleaser main: .) and scripts/install.sh are unaffected.
  • New in pkg/templates: ValidateTemplateData, RenderServer, TemplatesSHA256. No template file is changed; tnctl bootstrap still calls Execute directly, so its output is unchanged.
  • Golden files testdata/{server,agent,docker_server}.golden.sh rendered from the main@7bb1bea templates with fixed non-PEM placeholder data.
  • README section "Using the templates from Go".

device-controller (WP-DC1) pins the head commit of this branch as a pseudo-version; re-pin to the merged commit (or a pkg/templates/v0.1.0 tag) after merge. No tags are pushed from this PR.

Tests run

  • go build ./... && go vet ./... && go test ./... in the repo root and in pkg/templates: pass
  • Golden: Execute output equals each golden byte for byte; RenderServer equals the server golden
  • Rejection table: every unsafe character (", backtick, $, \, newline) x every field; newline allowed only in RSAPrivate/RSAPublic; no error string contains the input
  • TemplatesSHA256 deterministic; changing one byte of any (in-test copy) template changes the hash
  • Scratch module: go get github.com/teknoir/cli/pkg/templates@<head> succeeds and a program calling RenderServer builds and runs
  • gitleaks detect --log-opts=origin/main..HEAD: no leaks (pre-existing findings in older history are unrelated)

🤖 Generated with Claude Code

…gerprint and golden tests

Rename the root module to github.com/teknoir/cli and make pkg/templates its
own dependency-free module (github.com/teknoir/cli/pkg/templates) so other
programs can import the bootstrap templates without the CLI's dependencies.
Template files are unchanged; tnctl bootstrap still calls Execute directly.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tekn0ir and others added 3 commits October 12, 2026 11:01
…3s CA/install libraries

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tekn0ir
tekn0ir marked this pull request as ready for review October 12, 2026 11:08
@tekn0ir
tekn0ir merged commit 9c099f7 into main Oct 12, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant